package com.cc.comm;

import lombok.Data;

import java.util.List;

@Data
public class Page<T> {
    //当前页码
    private Integer pageNum =1;
    //每页显示数量
    private Integer pageSize =2;
    //总记录数
    private Integer totalCount;
    //总页数
    private Integer totalPage;
    //数据集合
    private List<T> data;

    public void setTotalCount(Integer totalCount){
        if (totalCount > 0){
            this.totalCount = totalCount;
            this.totalPage = totalCount % pageSize == 0 ? totalCount /pageSize :totalCount / pageSize +1;
        }
    }
}
